import {createRouter, createWebHashHistory, RouteRecordRaw, RouterView} from 'vue-router'
// import {strategy, terminal, user, role, logs} from './modules'

//引入nprogress
import NProgress from 'nprogress' // 进度条
import 'nprogress/nprogress.css' // 进度条样式

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'layout',
        component: () => import(/* webpackChunkName: "layout" */ '@/layout/index.vue'),
        meta: {
            title: '首页'
        },
        children: []
    },
    {
        path: '/login',
        name: 'login',
        component: () => import(/* webpackChunkName: "login" */ '@/views/login/index.vue')
    },
    {
        path: '/404',
        name: '404',
        component: () => import(/* webpackChunkName: "404" */ '@/views/error/404.vue')
    },
    {
        path: '/test',
        name: 'test',
        component: () => import(/* webpackChunkName: "test" */ '@/components/modal/basic-modal.vue')
    }
]

const router = createRouter({
    // process.env.BASE_URL
    history: createWebHashHistory(''),
    routes
})

// 简单配置
NProgress.inc(0.2)
NProgress.configure({easing: 'ease', speed: 500, showSpinner: false})

// router.beforeEach((to, from, next) => {
//     NProgress.start()
//     next()
// })
//
// router.afterEach(() => {
//     NProgress.done()
// })

export default router
